import 'dart:convert';

import '../request/base_request.dart';

/// 统一网络层返回格式
class HiNetResponse<T> {
  HiNetResponse({
    this.data,
    this.statusCode,
    this.statusMessage,
    this.extra,
    this.request,
  });

  T? data;

  int? statusCode;

  String? statusMessage;

  dynamic extra;

  BaseRequest? request;

  @override
  String toString() {
    if (data is Map) {
      return json.encode(data);
    }
    return data.toString();
  }
}
